<?php

$posts = array();
$url = '../images/contents/';
$urlthumb = '../../../../images/contents/';
$objScan = scandir("images/contents");
$except = array(".", "..");
foreach ($objScan as $value) {
    if(!in_array($value, $except)){
        $posts[] = array('image' => $url . $value, 'thumb' => $urlthumb . $value, 'folder' => 'IMG');
    }
}
$fp = fopen('ckeditor/plugins/imagebrowser/browser/images_list.js', 'w');
fwrite($fp, json_encode($posts));
fclose($fp);
?> 